﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using QianBaiLicense;

public partial class login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {


    }
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {

        string strLicPath = Request.MapPath(".") + "\\JJXT.LIC";
        string strMsg = "";

        if (!CheckLic.checknow(strLicPath, ref strMsg))
        {

            Response.Write("<script>alert('" + strMsg + "');</script>");
            Response.Write("<script>document.location=document.location;</script>");
            return;

        }


        string strUserName = this.UserName.Value.Trim();
        string strPass = this.PassWord.Value.Trim();

        string strsql = "SELECT * FROM [yuangong] where [name] = '" + strUserName + "'";
        ManageData md = new ManageData(util.DATACONNECTION);
        DataSet ds = md.ExecDS(strsql);
        if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
        {

            loginusr l = new loginusr(ds.Tables[0].Rows[0]["id"].ToString(),
                    ds.Tables[0].Rows[0]["showname"].ToString(),
                    "0",
                    "0",
                    "0");

            Session["login"] = l;

            Response.Redirect("main.aspx");
        }
        else
        {
            Response.Write(util.GetResponseAlert("用户登录失败"));
            Response.Write("<script>document.location=document.location;</script>");
            return;

        }

    }
    protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
    {
        this.UserName.Value = "";
        this.PassWord.Value = "";
    }
}
